// Learn cc.Class:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
// Learn Attribute:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
// Learn life-cycle callbacks:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html

cc.Class({
    extends: cc.Component,

    properties: {
        labTimes: cc.Label,  //时间
        labMoney: cc.Label,  //钱数
        labLottery: cc.Label,  //彩种类型
        labWhereDec: cc.Label,  //订单类型(收入/支出)  
        _data:null,

    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {
        if(this._data != null)
        {
            this.labTimes.string = this._data.ymdtimes;
            this.labLottery.string =this._data.where; 
            if(this._data.whereDce == "支出 "){
                this.labWhereDec.node.color = new cc.Color(59,133,255); //蓝色 
                this.labMoney.node.color = new cc.Color(59,133,255);
                this.labWhereDec.string = this._data.whereDce;  
                this.labMoney.string = "-"+this._data.Money+' 元宝';    
            }else{
                var color = new cc.Color(230,74,64); //红色
                this.labWhereDec.node.color = color;
                this.labMoney.node.color = color;
                this.labWhereDec.string = this._data.whereDce;  
                this.labMoney.string = "+"+this._data.Money+' 元宝';    
            }
        }
    },

    init:function(ret){
        this._data = ret;
    },

    // update (dt) {},
});
